<?php

namespace App\Models\Activity;

use Illuminate\Database\Eloquent\Model;

class StoreGiftPrize extends Model
{

    protected $table = 'store_gift_prize';

    protected $primaryKey = 'id';

    public $timestamps = false;

    public $incrementing = false;

    public static function getList( $args_array ) {

        if ( !isset( $args_array['activity_id'] ) || !ebsig_is_int( $args_array['activity_id'] ) ) {
            return [];
        }

        $where = [];
        $where[] = ['activity_id','=',$args_array['activity_id']];

        if ( isset( $args_array['customer_type'] ) && in_array( $args_array['customer_type'] , array( 1 ,2 ) ) ) {
            $where[] = ['customer_type','=',$args_array['customer_type']];
        }

        return self::where($where)->get()->toArray();

    }

}